package com.core.framework.db.jdbc;

import java.util.List;

import com.core.framework.db.IService;
import com.core.framework.db.jdbc.page.Page;
/**
 * 基础Service 业务层 统一实现接口
 * @author 刘涛
 * @since Jun 29, 2012
 * @param <T>
 */
public abstract class BaseService<T> extends ServiceSupport<T> implements IService<T>{

	public void delete(String  pk) {
			this.getDao().deleteObject(pk);
	}

	public List<T> getList(String pk) {
		return this.getDao().getList(pk);
	}

	public T getObject(String pk) {
		return this.getDao().getObject(pk);
	}

	public Page<T> getPage(Page<T> page, Object... objects) {
		// TODO Auto-generated method stub
		return null;
	}

	public Page<T> getPage(Page<T> page) {
		return null;
	}

	public void save(T  obj) {
		this.getDao().saveObject(obj);
	}
	public void saveByAutoUUID(T  obj) {
		this.getDao().saveObjectByAutoUUID(obj);
	}

	public void saveOrUpdate(T  obj) {
		Object value = this.getDao().getPkValue(obj);
		if(value==null)
		{
			this.getDao().saveObjectByAutoUUID(obj);
		}
		else
		{
			this.getDao().updateObject(obj);
		}
	}

	public void update(T  obj) {
		this.getDao().updateObject(obj);
	}


}
